package cool.webstudy.admin.utils;

import java.util.Calendar;
import java.util.Date;

/**
 * @author 莫振双
 * @date 2025/3/19 22:33
 * @description: corn表达式工具类
 */
public class CornUtil {
    //将Date中的时分秒转化为corn表达式
    public static String getTimeCornFormatStr(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        StringBuilder builder = new StringBuilder();
        builder.append(cal.get(Calendar.SECOND));
        builder.append(" ");
        builder.append(cal.get(Calendar.MINUTE));
        builder.append(" ");
        builder.append(cal.get(Calendar.HOUR_OF_DAY));
        builder.append(" * * ?");
        return builder.toString();
    }
}
